package org.hawk.gwtppc.webtest.tests.classsuite;

import org.hawk.gwtppc.webtest.common.Asserts;
import org.hawk.gwtppc.webtest.common.Test;
import org.hawk.gwtppc.webtest.tests.mock.ClassMock;
import org.hawk.gwtppc.webtest.tests.mock.SubClassMock1;
import org.hawk.gwtppc.webtest.tests.mock.SubClassMock2;

public class AsSubclassTest implements Test {

	public void run() throws Throwable {
		Class<?> classMockClass = SubClassMock1.class.asSubclass(ClassMock.class);
		Asserts.assertEquals(classMockClass, SubClassMock1.class);
		
		try {
			SubClassMock1.class.asSubclass(SubClassMock2.class);
			Asserts.fail("Wrong cast!");
		} catch (ClassCastException ex) {
		}
	}

	public String getName() {
		return "asSubclass(Class)";
	}

}
